﻿<?
error_reporting(0);
include("../config/header.php");
?>
<script type='text/javascript'>
	document.title = 'HTTP Header信息检测 —— 在线工具';
</script>
<?php
error_reporting(0);
function _get_header($url) {
if(function_exists('curl_init')){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_NOBODY, 1);
curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate");
$data=curl_exec($curl);
$source = explode("\r\n",$data);
foreach ($source as $header){
$headers.=$header.'<br />';
}
curl_close($curl);
echo $headers;
}else{
$header=get_headers($url); //注意啊！不是curl获取的参数是看不到 gzip 的
foreach ($header as $headers){
echo $headers."<br />";
}
}
}
?>
<div class="container">
	<div class="alert alert-info" role="alert">非常感谢网友hackercc分享此源码</div>
	<div class="panel panel-primary">
		<div class="panel-heading"><h3 class="panel-title">HTTP Header信息检测</h3></div>
	</div>
	<div class="form-group">
		<form method="post" name="fmCalcu" id="fmCalcu" action="">
		<div class="input-group">
			<input placeholder="Please input string to be encrypted ..." type="text" name="url" id="url" class="form-control" size="48"/>
			<span class="input-group-btn scan-but-span">
			<input type="submit" class="btn btn-success" value="检测"/>
			</span>
		</div>
		</form>
	</div>
	<div class="form-group">
		<?php
echo $_POST['url']?'':'利用CURL获取你网址或域名的HTTP头,可以检测是否开启GZIP或者测试其他信息.';
?>
<?php
echo '网页: '.$_POST['url'].' 的文件头.<br /><br />';
_get_header($_POST['url']);
?>

	</div>
</div>
<?php
include("../config/footer.php");
?>